Skip to main content

All Questions

6votes
2answers
445views

Simplify Generic Method

I am writing a GenericDeserializer for Apache Kafka. My class implements IDeserializer<T> from Confluent.Kafka.Net package....
ndogac's user avatar
3votes
1answer
1kviews

JSON serializable string enum in C# with generic JsonConverter

How can StringEnumeration be changed in the code below into a generic class, so that ConsensusState wouldn't need the ...
ery245gs's user avatar
14votes
6answers
12kviews

Calculate fingerprint for an object

I need to store serialized objects in a database and I want to avoid duplicates. In order to be able to tell wheter an object is already stored, I have to compare them somehow. My idea was to ...
t3chb0t's user avatar
  • 44.4k
13votes
3answers
7kviews

Structure to ByteArray Extension

I have a need to turn various structures into byte arrays to be sent over serial port to another machine. I created generic extensions to turn any structure into a byte array and from a byte array ...
RubberDuck's user avatar
2votes
1answer
5kviews

A Dynamic CSV Serializer

I made a dynamic CSV serializer as a learning challenge a while back, I'm hoping to get my code picked apart so I can learn what I can do better. This is a bit long, so I wouldn't expect anyone to ...
Douglas Gaskell's user avatar
9votes
2answers
10kviews

Type to byte array conversion in Swift

I need the byte representation of a given type, especially double, float, int8, etc. ...
Michael Dorner's user avatar
1vote
1answer
400views

Dynamic CSV Formatter

I made a dynamic CSV formatter as a personal challenge after having to hardcode a behavior to convert some data to CSV earlier. You input any List that contains supported types as properties (all ...
Douglas Gaskell's user avatar
2votes
0answers
283views

Better way to deep copy than this? How can I make it generic by `Collection` type?

Could I make this method for deep copy generic to the Collection type? That method is so simple and I can't imagine ever needing to change it, so maybe I should ...
david.t's user avatar
9votes
2answers
2kviews

Optimize a generic foreach method that converts Datatable to my object using Reflection

I need to optimize this code block below, this method converts a Datatable object to the Object that I am passing by parameter, in another words, this serializes the object, however I have to run this ...
Roger's user avatar
11votes
3answers
5kviews

Simple Generic output for Deserializer

Lately I have been learning about serialization so I decided to write a little helper class for my application to make it easy to use this feature in multiple places. I actually mixed some generics in ...
Mehrad's user avatar
3votes
3answers
836views

Forcing type-safe IDs for use with Collections and Maps

Introduction I have a hierarchically nested tree class (like SampleFolder, s.b.) that I want to serialize. The problem arises with the collection of sub items ...
zsawyer's user avatar
10votes
3answers
18kviews

Serialize C# objects of unknown type to bytes using generics

Usage example var qm = new QueueMessage("foo", 99); var ba = ByteArraySerializer<QueueMessage>.Serialize(qm)); Class that performs the serialization / ...
codingoutloud's user avatar

close